package com.wonders.frame.controller;

import com.gcr.server.response.Response;
import com.wonders.frame.controller.core.CoreController;
import com.wonders.frame.entity.AuthSta;
import com.wonders.frame.service.AuthStaService;
import com.wonders.frame.service.Core.CoreCurdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.locks.ReentrantLock;

/**
 * @author:admin
 * @Create:2019-05-14
 */
@RestController
@RequestMapping("/authSta")
public class AuthStaController extends CoreController<AuthSta> {

    @Autowired
    private AuthStaService service;

    @Override
    protected CoreCurdService getService() {
        return service;
    }

    private final ReentrantLock lock=new ReentrantLock();

    // 飞防组织
    @RequestMapping("getAuthOrga")
    public Response getAuthOrga() {

        try {
            return successResponse(service.getAuthOrga());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }
    // 装备成员
    @RequestMapping("getEquipmentMember")
    public Response getEquipmentMember() {
        try {
            return successResponse(service.getEquipmentMember());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }
    // 作业订单
    @RequestMapping("getJobOrder")
    public Response getJobOrder() {
        try {
            return successResponse(service.getJobOrder());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }

    // 作业概况
    @RequestMapping("getJobType")
    public Response getJobType() {
        try {
            return successResponse(service.getJobType());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }

    //作业面积
    @RequestMapping("getWorkArea")
    public Response getWorkArea() {
        try {
            return successResponse(service.getWorkArea());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }
    //无人机出动总次数
    @RequestMapping("getUfCount")
    public Response getUfCount() {
        try {
            return successResponse(service.getUfCount());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }

    @RequestMapping("getUf")
    public Response getUf() {
        try {
            return successResponse(service.getUf());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }

    @RequestMapping("getMember")
    public Response getMember() {
        try {
            return successResponse(service.getMember());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }
    //作业排行
    @RequestMapping("getJobTop")
    public Response getJobTop() {
        try {
            return successResponse(service.getJobTop());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }

    //作业排行
    @RequestMapping("getJobTop10")
    public Response getJobTop10() {
        try {
            return successResponse(service.getJobTop10());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }

    @RequestMapping("getAreaUf")
    public Response getAreaUf() {
        try {
            return successResponse(service.getAreaUf());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }

    @RequestMapping("getAreaJob")
    public Response getAreaJob() {
        try {
            return successResponse(service.getAreaJob());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }

    @RequestMapping("getAreaCount")
    public Response getAreaCount() {
        try {
            return successResponse(service.getAreaCount());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }

    @RequestMapping("getAreaJobTop10")
    public Response getAreaJobTop10() {
        try {
            return successResponse(service.getAreaJobTop10());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }

    @RequestMapping("getAreaJobType")
    public Response getAreaJobType() {
        try {
            return successResponse(service.getAreaJobType());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }


    @RequestMapping("getMileCount")
    public Response getMileCount() {
        try {
            return successResponse(service.getMileCount());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }

    @RequestMapping("getMileAvg")
    public Response getMileAvg() {
        try {
            return successResponse(service.getMileAvg());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }

    @RequestMapping("getJobCount")
    public Response getJobCount() {
        try {
            return successResponse(service.getJobCount());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }

    @RequestMapping("getJobArea")
    public Response getJobArea() {
        try {
            return successResponse(service.getJobArea());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }


    @RequestMapping("getAnalysisMonth")
    public Response getAnalysisMonth() {
        try {
            return successResponse(service.getAnalysisMonth());
        }catch (Exception e) {
            e.printStackTrace();
            return errorResponse();
        }
    }
}
